<template>
    <div class="main-body-wrap">
        <div class="main-left">
            <div class="left_title">
                <span class = "left_title_item"><b class = "time"></b>出发时间<i> / </i><span>2017-10-31</span></span>
                <span class = "left_title_item"><b class = "day"></b>出行天数<i> / </i><span>35天</span></span>
                <span class = "left_title_item"><b class = "rela"></b>人物<i> / </i><span>情侣/夫妻</span></span>
                <span class = "left_title_item"><b class = "cost"></b>人均费用<i> / </i><span>12110RMB</span></span>
            </div>
            <div class = "content txt-content" v-html="content">
                
            </div>
        </div>
        <div class="main-right">
            <!-- 轮播图区域 -->
            <div class="block">
                <div class = "slid_box">
                    <div class = "title">
                        <h3>旅行家专栏</h3>
                        <router-link class = "skip" to = "">专栏首页</router-link>
                    </div>
                    <!-- 给轮播图添加导航按钮 -->
                    <ul class = "swiper_btn">       
                        <li v-for = "(item, index) of 5" :key = "index" :class = "{active: active == index}" @click = "controlSwiper(index)"></li>
                    </ul>
                    <el-carousel ref = "aa" @change = "carousel" height="256px"  class = "show_box" indicator-position = "none">
                        <el-carousel-item class  = "show_item" v-for="(item, i) in list" :key="i">
                            <img :src="item.url" alt=""  @click="swipers(i)">
                            <span class = "title">{{item.title}}</span><br>
                            <span class = "content">{{item.content}}</span>
                            
                        </el-carousel-item>
                    </el-carousel>
                </div>
                <!-- 第二个区域 -->
            <div class="content_item_1">
                <div class = "title">
                    <h3>旅游攻略推荐</h3>
                    <router-link class = "skip" to = "">更多</router-link>
                </div>
                <div class = "item_1_content">
                    <router-link to = ""><img src="https://n1-q.mafengwo.net/s13/M00/2F/98/wKgEaVyLS9-AIVVgAAGRmxCXIQI26.jpeg?imageMogr2%2Fthumbnail%2F%21260x139r%2Fgravity%2FCenter%2Fcrop%2F%21260x139%2Fquality%2F100" alt=""></router-link>
                    <router-link class = "title_skip" to = "">
                        3条自驾路线，带你玩转南京周边的村落，草原和花...
                    </router-link>
                </div>
            </div>
            <!-- 第三个区域 -->
            <div class="content_item_2">
                <div class = "title">
                    <h3>最新活动</h3>
                    <router-link class = "skip" to = "">查看全部</router-link>
                </div>
                <div class = "item_1_content">
                    <router-link to = ""><img src="https://n1-q.mafengwo.net/s18/M00/37/28/CoUBYGDIcK-AQInXAAIee_tFC4s83.jpeg?imageView2%2F2%2Fw%2F260%2Fh%2F178%2Fq%2F90" alt=""></router-link>
                    <router-link class = "title_skip" to = "">
                        潮玩旅行路书
                    </router-link>
                    <p>来定制路书，跟哈弗一起去潮玩！</p>
                </div>
            </div>
            </div>
            
        </div>
    </div>
</template>

<script>
export default {
    name: 'WorkspaceJsonMainBody',

    data() {
        return {
            list: [
                {
                    "url": "https://b3-q.mafengwo.net/s13/M00/71/D6/wKgEaVyd7i6AFjCjAADni5x-vvY89.jpeg",
                    "title": "夏木尼，小王子的玫瑰城市",
                    "content": "夏木尼（Chamounix）是法国勃朗峰脚下最著名的小城，《小王子》里的玫瑰城市，世界登山运动的发源地。"
                },
                {
                    "url": "https://n2-q.mafengwo.net/s13/M00/72/B9/wKgEaVyd7ryAdEkeAADZPC_YEuI86.jpeg",
                    "title": "暹粒油淋鱼",
                    "content": "默默等待，鱼上桌，迅速夹一口塞在嘴里——我就像个戒烟多日的老烟枪终于抽上了烟，心里的空洞瞬间被填满了。"
                },
                {
                    "url": "https://n4-q.mafengwo.net/s13/M00/74/67/wKgEaVyd79SAD6lVAAC7rgrAj0E79.jpeg",
                    "title": "西安：旧长安的画皮",
                    "content": "西安这座曾经的13朝古都，在今天更像旧长安的画皮，城墙完整绵延，一切就像一张唐画的影印本。"
                },
                {
                    "url": "https://n1-q.mafengwo.net/s13/M00/FB/B9/wKgEaVycpr6Ae-TXAAC_Ffkpk0s50.jpeg",
                    "title": "漫山岛",
                    "content": "漫山岛在第二条路上，满眼都是天赋，却偏爱挥霍青山绿水，用自己的方式过小日子，即便强行拖它起来，也得不到结果。"
                },
                {
                    "url": "https://n3-q.mafengwo.net/s13/M00/FD/07/wKgEaVycp3-AVimPAADWiqvk6ek72.jpeg",
                    "title": "胡日尔镇的美术馆",
                    "content": "我最终从胡日尔的美术馆里带走了一幅画，画的是冬日的萨满岩，是日落时分。"
                }

            ],
            active: "",
            newslist:[
                {   
                    "id":1,
                    "data":"04月07日",
                    "titlehd":'马蜂窝"云旅游"直播的攻与守',
                },
                 {   
                    "id":2,
                    "data":"04月01日",
                    "titlehd":'马蜂窝的"云上战役"',
                },
                 {   
                    "id":3,
                    "data":"02月13日",
                    "titlehd":'科技"战役":马蜂窝大数据赋能旅游业',
                },
                {   
                    "id":4,
                    "data":"02月19日",
                    "titlehd":'陈罡:疫情下旅游业的"守恒与求变"',
                },
                {   
                    "id":5,
                    "data":"02月06日",
                    "titlehd":'马蜂窝将退订完成率定为最高KPI',
                },
                {   
                    "id":6,
                    "data":"09月28日",
                    "titlehd":'马蜂窝国庆白领出游偏好调查: 超7...',
                }],
            content: '',
            mid: 5
        };
    },

    mounted() {
        if(location.search.split("=")[1]) {
            this.mid = location.search.split("=")[1];
        }
        this.$http.get(`/communDetail?mid=${this.mid}`).then(result => {
        this.content = result.data.data[0].content;
        
        
        })
    },
    updated() {
        let div = document.getElementsByClassName("content")[0];
        let a = div.querySelectorAll("a");
        for(let item of a) {
            
            item.onclick = function(e) {
                e.preventDefault();
            }
        }
    },
    methods: {
        carousel(e) {
            this.active = e;
        },
        controlSwiper(index) {
            this.$refs.aa.setActiveItem(index);
        },
         swipers(i){
            let mid = Number(i+50)
            this.$router.push('/community?mid='+mid)
            // 刷新页面
            history.go(0)
        },
    },
    created(){
        let mid = this.$route.query.mid
    }
};
</script>

<style lang="scss" scoped >
*{
    color: #666;
    font-size: 14px;
    line-height: 2;
}


.main-body-wrap{
    width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
    .main-left{
        width: 780px;
        min-height: 600px;
        margin-top: 40px;
        .left_title {
            height: 100px;
            border: 1px dashed #d7d7d7;
            font-size: 14px;
            color: #666;
            padding: 0 80px 0 0px;
            line-height: 49px;
            .left_title_item {
                display: inline-block;
                width: 190px;
                height: 25px;
                padding-left: 25px;
                i {
                    color: #ff9d00;
                }
                b {
                    display: inline-block;
                    width: 22px;
                    height: 22px;
                    background: url("../.././assets/home_detail_icon/home_detail_icon.png") no-repeat;
                    vertical-align: middle;
                    margin-right: 10px;
                    margin-top: -2px;
                }
                .time {
                    background-position: -22px 0;
                }
                .day {
                    background-position: -22px -22px;
                }
                .rela {
                    background-position: -22px -44px;
                }
                .cost{
                    background-position: -22px -66px;
                }
            }

        }
        
    }
    .main-right{
        width: 290px;
        min-height: 600px;
        .block {            //轮播图部分
            margin-top: 35px;
            position: relative;
            .show_box {
                .show_item {
                    img {
                        width: 100%;
                    }
                    .title {
                        display: inline-block;
                        margin: 5px 0;
                    }
                    .content {
                        font-size: 14px;
                        color: #666666; 
                    } 
                }
                .el-carousel__item:nth-child(n) {
                    background-color: transparent;
                }
                
            
            }
            .swiper_btn {           //轮播图按钮
                position: absolute;
                left: 85px;
                top: 169px;
                list-style: none;
                margin: 0;
                padding: 0;
                z-index: 100;
                li {
                list-style: none;
                    float: left;
                    width: 16px;
                    height: 16px;
                    // border: 1px solid white;
                    border-radius: 8px;
                    background-color: rgba(65, 193, 236, 0.2);
                    margin-left: 5px;
                    cursor: pointer;
                }
                .active {
                    background-color: #41c1ec;

                }
            }
            .title {
                display: flex;
                justify-content: space-between;
                margin-bottom: 20px;
                h3 {
                    font-weight: 500;
                    color: #333333;
                    font-size: 18px;

                }
                .skip {
                    margin-top: 3px;
                    font-size: 12px;
                    color: #999999;
                    text-decoration: none;
                    &:hover {
                        text-decoration: underline;
                    }
                }
            }
            .content_item_1 {
                margin-top: 30px;
                img {
                    width: 100%;
                    margin-bottom: 10px;

                }
                .title_skip {
                    display: inline-block;
                    width: 280px;
                    font-size: 16px;
                    color: #333333;
                    text-decoration: none;
                    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
                    &:hover {
                        color: #41c1ec;
                        text-decoration: underline;
                    }
                }

            }
            /* _j_note_content _j_seqitem */
            .content_item_2 {
                margin-top: 30px;
                margin-bottom: 30px;
                img {
                    width: 100%;
                    margin-bottom: 10px;
                }
                .title_skip {
                    display: inline-block;
                    width: 280px;
                    font-size: 16px;
                    color: #333333;
                    text-decoration: none;
                    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
                    &:hover {
                        color: #41c1ec;
                        text-decoration: underline;
                    }
                }
                p {
                    font-size: 14px;
                    color: #999999;
                }

            }
        }
    }
}
._j_seqitem {
    padding-right: 10px!important;
}

</style>
<style>
.content {
    text-align:left;
    color: #666;
}
.content h2 {   
    margin: 10px 0;
}
.content a  {
    color: #666;
    text-decoration: none;
}
.content div img {
    width: 780px !important;
    height: auto !important;
    margin: 20px 0 ;
}

</style>